import Vue from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";
import "lib-flexible"; // 适配
import urls from "@/api/index.js";
import request from "@/utils/request";
import defaultSettings from "@/settings";
import "@/style/common.less";

Vue.prototype.$axios = request;
Vue.prototype.$urls = urls;

// 利用路由守卫设置页面标题
router.beforeEach((to, from, next) => {
  if (to.meta.title) {
    document.title = to.meta.title;
  }
  next();
});

// 打开vscode的调试
if (
  process.env.NODE_ENV === "development" ||
  (process.env.NODE_ENV === "staging" && defaultSettings.vconsole)
) {
  const VConsole = require("vconsole");
  // eslint-disable-next-line
  const my_console = new VConsole();
}

Vue.config.productionTip = false;

new Vue({
  router,
  store,
  render: (h) => h(App),
}).$mount("#app");
